function [peaks, locs] = findPeriodicPeaks(x, T)
    num_periods = floor(length(x)/T);
    peaks = [];
    locs = [];
    for i = 1:num_periods
        start_idx = (i-1)*T + 1;
        end_idx = i*T;
        segment = x(start_idx:end_idx);
        [pks, lcs] = findpeaks(segment);
        if ~isempty(pks)
            [max_peak, idx] = max(pks);
            peaks = [peaks; max_peak];
            locs = [locs; start_idx + lcs(idx) - 1];
        end
    end
end